package com.suntine.familytree.core.framework.service;

import java.io.Serializable;
import java.util.List;

import org.apache.log4j.Logger;

import com.suntine.familytree.core.framework.dao.BaseDao;

/**
 * @corporation 
 * @author suntine
 * @creation 2011-4-14 下午03:25:04
 * @description 
 */
public abstract class BaseServiceJpaImpl<T extends Serializable> implements BaseService<T> {

	

	protected BaseDao<T> dao;
	protected transient Logger logger ;
	
	public BaseServiceJpaImpl() {
		super();
	}
	
	public void initLogger(Class clazz){
		logger = Logger.getLogger(clazz);;
	}
	
	public BaseDao<T> getDao() {
		return dao;
	}
	
	public void setDao(BaseDao<T> dao) {
		this.dao = dao;
	}
	@Override
	public T save(T entity) {
		return this.dao.save(entity);
	}

	@Override
	public int delete(T entity) {
		return this.dao.delete(entity);
	}

	@Override
	public T findById(long id) {
		return this.dao.findById(id);
	}

	@Override
	public int update(T entity) {
		return this.dao.update(entity);
	}

	@Override
	public List queryByJpql(String jpql) {
		return this.dao.queryByJpql(jpql);
	}
	
	@Override
	public List queryAll() {
		// TODO Auto-generated method stub
		return this.dao.queryAll();
	}
}
